```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring Boot Profiles环境隔离指南 | 技术小馆</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        :root {
            --primary: #4F46E5;
            --primary-light: #6366F1;
            --secondary: #10B981;
            --dark: #1F2937;
            --light: #F3F4F6;
            --accent: #F59E0B;
        }
        
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.8;
        }
        
        .hero {
            background: linear-gradient(135deg, rgba(79, 70, 229, 0.9) 0%, rgba(99, 102, 241, 0.9) 100%);
        }
        
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        }
        
        .code-block {
            background-color: #2D2D2D;
            border-radius: 0.5rem;
            font-family: 'Consolas', 'Monaco', 'Andale Mono', monospace;
        }
        
        .highlight {
            position: relative;
        }
        
        .highlight::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 30%;
            background-color: rgba(245, 158, 11, 0.2);
            z-index: -1;
        }
        
        .section-divider {
            border: none;
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.5), transparent);
        }
        
        .mermaid {
            background-color: white;
            padding: 1.5rem;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 md:py-32 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl text-center">
            <div class="inline-block px-3 py-1 mb-4 text-sm font-semibold text-indigo-100 bg-indigo-800 rounded-full">
                <i class="fas fa-code-branch mr-2"></i>Spring Boot 最佳实践
            </div>
            <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight">使用Profiles实现环境隔离</h1>
            <p class="text-xl md:text-2xl text-indigo-100 max-w-3xl mx-auto mb-8">优雅管理开发、测试与生产环境的配置差异</p>
            <div class="flex justify-center space-x-4">
                <a href="#what-is-profiles" class="px-6 py-3 bg-white text-indigo-700 font-medium rounded-lg hover:bg-gray-100 transition duration-300">
                    <i class="fas fa-book-open mr-2"></i>立即学习
                </a>
                <a href="#practice-example" class="px-6 py-3 border-2 border-white text-white font-medium rounded-lg hover:bg-white hover:bg-opacity-10 transition duration-300">
                    <i class="fas fa-laptop-code mr-2"></i>实践示例
                </a>
            </div>
        </div>
    </section>

    <!-- Table of Contents -->
    <section class="py-12 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="bg-white rounded-xl shadow-md p-6">
                <h2 class="text-2xl font-bold mb-6 text-gray-800 flex items-center">
                    <i class="fas fa-list-ul text-indigo-500 mr-3"></i>文章目录
                </h2>
                <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
                    <a href="#what-is-profiles" class="group flex items-center p-3 rounded-lg hover:bg-indigo-50 transition duration-300">
                        <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-4 group-hover:bg-indigo-200 transition duration-300">
                            <i class="fas fa-question-circle"></i>
                        </div>
                        <div>
                            <h3 class="font-medium text-gray-800 group-hover:text-indigo-600">什么是Profiles</h3>
                            <p class="text-sm text-gray-500">基本概念与配置管理</p>
                        </div>
                    </a>
                    <a href="#basic-knowledge" class="group flex items-center p-3 rounded-lg hover:bg-indigo-50 transition duration-300">
                        <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-4 group-hover:bg-indigo-200 transition duration-300">
                            <i class="fas fa-graduation-cap"></i>
                        </div>
                        <div>
                            <h3 class="font-medium text-gray-800 group-hover:text-indigo-600">基础知识</h3>
                            <p class="text-sm text-gray-500">Profile定义与配置文件</p>
                        </div>
                    </a>
                    <a href="#config-organization" class="group flex items-center p-3 rounded-lg hover:bg-indigo-50 transition duration-300">
                        <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-4 group-hover:bg-indigo-200 transition duration-300">
                            <i class="fas fa-sitemap"></i>
                        </div>
                        <div>
                            <h3 class="font-medium text-gray-800 group-hover:text-indigo-600">配置文件组织</h3>
                            <p class="text-sm text-gray-500">结构与最佳实践</p>
                        </div>
                    </a>
                    <a href="#profile-activation" class="group flex items-center p-3 rounded-lg hover:bg-indigo-50 transition duration-300">
                        <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-4 group-hover:bg-indigo-200 transition duration-300">
                            <i class="fas fa-power-off"></i>
                        </div>
                        <div>
                            <h3 class="font-medium text-gray-800 group-hover:text-indigo-600">Profile激活</h3>
                            <p class="text-sm text-gray-500">多种激活方式</p>
                        </div>
                    </a>
                    <a href="#conditional-config" class="group flex items-center p-3 rounded-lg hover:bg-indigo-50 transition duration-300">
                        <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-4 group-hover:bg-indigo-200 transition duration-300">
                            <i class="fas fa-sliders-h"></i>
                        </div>
                        <div>
                            <h3 class="font-medium text-gray-800 group-hover:text-indigo-600">条件化配置</h3>
                            <p class="text-sm text-gray-500">@Profile注解使用</p>
                        </div>
                    </a>
                    <a href="#profile-priority" class="group flex items-center p-3 rounded-lg hover:bg-indigo-50 transition duration-300">
                        <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-4 group-hover:bg-indigo-200 transition duration-300">
                            <i class="fas fa-sort-amount-up"></i>
                        </div>
                        <div>
                            <h3 class="font-medium text-gray-800 group-hover:text-indigo-600">Profile优先级</h3>
                            <p class="text-sm text-gray-500">配置加载顺序</p>
                        </div>
                    </a>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 py-8">
        <!-- What is Spring Profiles -->
        <section id="what-is-profiles" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-500 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold text-gray-800">什么是Spring Profiles</h2>
            </div>
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1727756804134-538dec9c-56e8-4b97-8078-375b1a029b51.png" alt="Spring Profiles概念图" class="w-full h-auto">
                <div class="p-6">
                    <p class="text-lg text-gray-700 mb-6">Spring Profiles 是 Spring 框架提供的一种特性，用于实现应用程序的环境隔离和配置管理。通过使用 Profiles，开发者可以在不同的环境（如开发、测试和生产）中加载不同的配置，从而使应用程序能够根据其运行环境灵活调整其行为和配置。</p>
                    
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
                        <div class="card bg-gray-50 p-6 rounded-lg">
                            <div class="flex items-center mb-4">
                                <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-4">
                                    <i class="fas fa-cog"></i>
                                </div>
                                <h3 class="font-bold text-lg">基本概念</h3>
                            </div>
                            <ul class="space-y-2 text-gray-700">
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                    <span>Profile 是一种标记，表示应用程序在某个特定环境下的运行状态</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                    <span>可以将环境相关的配置逻辑从代码中分离出来</span>
                                </li>
                            </ul>
                        </div>
                        
                        <div class="card bg-gray-50 p-6 rounded-lg">
                            <div class="flex items-center mb-4">
                                <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-4">
                                    <i class="fas fa-sliders-h"></i>
                                </div>
                                <h3 class="font-bold text-lg">配置管理</h3>
                            </div>
                            <ul class="space-y-2 text-gray-700">
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                    <span>使用多个配置文件管理不同环境的配置</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                    <span>通过设置 spring.profiles.active 属性激活 Profile</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    
                    <h3 class="text-xl font-bold mb-4 text-gray-800">使用场景</h3>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
                        <div class="bg-blue-50 p-4 rounded-lg">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-database text-blue-500 mr-2"></i>
                                <h4 class="font-medium">数据库配置</h4>
                            </div>
                            <p class="text-sm text-gray-600">在开发环境中使用测试数据库，在生产环境中使用正式数据库</p>
                        </div>
                        <div class="bg-green-50 p-4 rounded-lg">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-cloud text-green-500 mr-2"></i>
                                <h4 class="font-medium">第三方服务</h4>
                            </div>
                            <p class="text-sm text-gray-600">在开发环境中使用 Mock 服务，在生产环境中使用真实服务</p>
                        </div>
                        <div class="bg-yellow-50 p-4 rounded-lg">
                            <div class="flex items-center mb-2">
                                <i class="fas fa-file-alt text-yellow-500 mr-2"></i>
                                <h4 class="font-medium">日志级别</h4>
                            </div>
                            <p class="text-sm text-gray-600">开发环境设置详细日志，生产环境减少日志以提升性能</p>
                        </div>
                    </div>
                    
                    <div class="bg-gray-100 p-6 rounded-lg mt-6">
                        <h4 class="font-bold text-lg mb-3 text-gray-800">@Profile注解示例</h4>
                        <div class="code-block text-gray-200 p-4 rounded-lg overflow-x-auto">
                            <pre><code>@Profile("dev")
@Component
public class DevDataSourceConfig {
    // 开发环境的数据源配置
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Basic Knowledge -->
        <section id="basic-knowledge" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-500 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold text-gray-800">Spring Profiles的基础知识</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                <img src="https://cdn.nlark.com/yuque/0/2024/png/21449790/1727756914084-a81bd618-0b60-415a-ac13-53025a206230.png" alt="Spring Profiles基础知识" class="w-full h-auto">
                <div class="p-6">
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
                        <div>
                            <h3 class="text-xl font-bold mb-4 text-gray-800">Profile的定义</h3>
                            <ul class="space-y-3 text-gray-700">
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-500 mr-2 mt-0.5">
                                        <i class="fas fa-info-circle"></i>
                                    </div>
                                    <span>Profile 是一种用于标识应用程序在某一特定环境下的状态的标记</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-500 mr-2 mt-0.5">
                                        <i class="fas fa-tags"></i>
                                    </div>
                                    <span>可以为应用程序的不同环境（开发、测试、生产）定义不同的配置</span>
                                </li>
                            </ul>
                        </div>
                        
                        <div>
                            <h3 class="text-xl font-bold mb-4 text-gray-800">配置文件</h3>
                            <ul class="space-y-3 text-gray-700">
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-500 mr-2 mt-0.5">
                                        <i class="fas fa-file-code"></i>
                                    </div>
                                    <span>使用后缀区分不同环境的配置文件：<br>application-dev.properties, application-test.properties</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-500 mr-2 mt-0.5">
                                        <i class="fas fa-file-alt"></i>
                                    </div>
                                    <span>主配置文件 application.properties 作为默认配置</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    
                    <div class="mb-8">
                        <h3 class="text-xl font-bold mb-4 text-gray-800">激活Profiles的三种方式</h3>
                        <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                            <div class="bg-gray-50 p-4 rounded-lg">
                                <div class="flex items-center mb-3">
                                    <div class="w-8 h-8 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-3">
                                        <i class="fas fa-terminal"></i>
                                    </div>
                                    <h4 class="font-bold">命令行</h4>
                                </div>
                                <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                    <code>java -jar myapp.jar --spring.profiles.active=dev</code>
                                </div>
                            </div>
                            <div class="bg-gray-50 p-4 rounded-lg">
                                <div class="flex items-center mb-3">
                                    <div class="w-8 h-8 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-3">
                                        <i class="fas fa-code"></i>
                                    </div>
                                    <h4 class="font-bold">环境变量</h4>
                                </div>
                                <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                    <code>export SPRING_PROFILES_ACTIVE=prod</code>
                                </div>
                            </div>
                            <div class="bg-gray-50 p-4 rounded-lg">
                                <div class="flex items-center mb-3">
                                    <div class="w-8 h-8 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-3">
                                        <i class="fas fa-file"></i>
                                    </div>
                                    <h4 class="font-bold">配置文件</h4>
                                </div>
                                <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                    <code>spring.profiles.active=dev</code>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-blue-50 p-6 rounded-lg">
                        <div class="flex items-center mb-4">
                            <i class="fas fa-lightbulb text-blue-500 text-2xl mr-3"></i>
                            <h3 class="text-xl font-bold text-blue-800">最佳实践建议</h3>
                        </div>
                        <ul class="space-y-3 text-blue-800">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle mt-1 mr-2"></i>
                                <span>Profile 的命名应该具有明确性和一致性</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle mt-1 mr-2"></i>
                                <span>避免将敏感信息硬编码在配置文件中</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle mt-1 mr-2"></i>
                                <span>为每个 Profile 提供详细的文档说明</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>

        <!-- Config Organization -->
        <section id="config-organization" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-500 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold text-gray-800">配置文件的组织</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="p-6">
                    <p class="text-lg text-gray-700 mb-8">在 Spring Boot 应用程序中，配置文件的组织是一个重要的方面，它直接影响到应用程序的可维护性、可扩展性和易用性。良好的配置文件组织不仅能够帮助开发者清晰地理解不同环境的配置，还能提升团队协作的效率。</p>
                    
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
                        <div>
                            <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                                <i class="fas fa-sitemap text-indigo-500 mr-2"></i>
                                <span>基本结构</span>
                            </h3>
                            <ul class="space-y-3 text-gray-700">
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-500 mr-2 mt-0.5">
                                        <i class="fas fa-file-alt"></i>
                                    </div>
                                    <span>主配置文件：application.properties 或 application.yml 作为默认配置</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-500 mr-2 mt-0.5">
                                        <i class="fas fa-code-branch"></i>
                                    </div>
                                    <span>环境特定配置文件：application-{profile}.properties</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-500 mr-2 mt-0.5">
                                        <i class="fas fa-layer-group"></i>
                                    </div>
                                    <span>模块化配置：可按功能模块拆分配置文件</span>
                                </li>
                            </ul>
                        </div>
                        
                        <div>
                            <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                                <i class="fas fa-file-signature text-indigo-500 mr-2"></i>
                                <span>命名规范</span>
                            </h3>
                            <ul class="space-y-3 text-gray-700">
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-500 mr-2 mt-0.5">
                                        <i class="far fa-file-code"></i>
                                    </div>
                                    <span>标准命名：application-{profile}.properties</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-500 mr-2 mt-0.5">
                                        <i class="fas fa-file-medical"></i>
                                    </div>
                                    <span>附加配置：application-dev-db.properties</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-500 mr-2 mt-0.5">
                                        <i class="fas fa-sort-alpha-down"></i>
                                    </div>
                                    <span>环境名简写：dev, test, prod, staging</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    
                    <h3 class="text-xl font-bold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-code text-indigo-500 mr-2"></i>
                        <span>YAML配置示例</span>
                    </h3>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
                        <div class="code-block text-gray-200 p-4 rounded-lg">
                            <pre><code class="text-sm">spring:
  datasource:
    url: jdbc:mysql://localhost:3306/mydb
    username: root
    password: secret
  jpa:
    hibernate:
      ddl-auto: update
    show-sql: true</code></pre>
                        </div>
                        <div class="bg-yellow-50 p-4 rounded-lg">
                            <div class="flex items-center mb-3">
                                <i class="fas fa-info-circle text-yellow-500 mr-2"></i>
                                <h4 class="font-bold">YAML优势</h4>
                            </div>
                            <ul class="space-y-2 text-sm text-gray-700">
                                <li>支持复杂数据结构</li>
                                <li>更直观的层级关系</li>
                                <li>减少重复配置</li>
                                <li>增强可读性</li>
                            </ul>
                        </div>
                    </div>
                    
                    <div class="bg-gray-100 p-6 rounded-lg">
                        <h3 class="text-xl font-bold mb-4 text-gray-800">配置继承与重写</h3>
                        <div class="mermaid mb-4">
                            graph TD
                            A[application.yml] -->|默认配置| B[application-dev.yml]
                            A -->|默认配置| C[application-prod.yml]
                            B -->|继承并重写| D[Dev Database]
                            C -->|继承并重写| E[Prod Database]
                        </div>
                        <p class="text-gray-700">当激活特定Profile时，Spring Boot会合并主配置文件和Profile特定配置，Profile特定配置中的属性会覆盖主配置中的同名属性。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Profile Activation -->
        <section id="profile-activation" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-500 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold text-gray-800">Profile的激活</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="p-6">
                    <p class="text-lg text-gray-700 mb-8">在Spring Boot中，Profile是一种强大的特性，用于在不同的环境中切换和管理配置。通过激活不同的Profile，开发者可以轻松地根据需求加载相应的配置文件，从而实现环境隔离。</p>
                    
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
                        <div>
                            <h3 class="text-xl font-bold mb-4 text-gray-800">激活方式对比</h3>
                            <div class="space-y-4">
                                <div class="bg-gray-50 p-4 rounded-lg">
                                    <h4 class="font-bold mb-2 flex items-center">
                                        <span class="w-6 h-6 rounded-full bg-blue-500 text-white flex items-center justify-center mr-2">1</span>
                                        <span>配置文件激活</span>
                                    </h4>
                                    <div class="code-block text-gray-200 p-3 rounded-lg text-sm mb-2">
                                        <code>spring.profiles.active=dev</code>
                                    </div>
                                    <p class="text-sm text-gray-600">适用于简单的环境设置，但在某些情况下可能不够灵活</p>
                                </div>
                                
                                <div class="bg-gray-50 p-4 rounded-lg">
                                    <h4 class="font-bold mb-2 flex items-center">
                                        <span class="w-6 h-6 rounded-full bg-green-500 text-white flex items-center justify-center mr-2">2</span>
                                        <span>命令行参数激活</span>
                                    </h4>
                                    <div class="code-block text-gray-200 p-3 rounded-lg text-sm mb-2">
                                        <code>java -jar myapp.jar --spring.profiles.active=prod</code>
                                    </div>
                                    <p class="text-sm text-gray-600">在部署时非常方便，允许动态选择Profile</p>
                                </div>
                                
                                <div class="bg-gray-50 p-4 rounded-lg">
                                    <h4 class="font-bold mb-2 flex items-center">
                                        <span class="w-6 h-6 rounded-full bg-purple-500 text-white flex items-center justify-center mr-2">3</span>
                                        <span>环境变量激活</span>
                                    </h4>
                                    <div class="code-block text-gray-200 p-3 rounded-lg text-sm mb-2">
                                        <code>export SPRING_PROFILES_ACTIVE=prod</code>
                                    </div>
                                    <p class="text-sm text-gray-600">在Docker容器或云平台中尤为常见</p>
                                </div>
                            </div>
                        </div>
                        
                        <div>
                            <h3 class="text-xl font-bold mb-4 text-gray-800">多Profile激活</h3>
                            <div class="bg-gray-50 p-6 rounded-lg mb-6">
                                <div class="code-block text-gray-200 p-4 rounded-lg">
                                    <pre><code>spring.profiles.active=dev,test</code></pre>
                                </div>
                                <p class="text-gray-700 mt-3">Spring Boot会合并dev和test这两个Profile的配置，后激活的Profile中的属性会覆盖先激活的Profile中的相同属性。</p>
                            </div>
                            
                            <h3 class="text-xl font-bold mb-4 text-gray-800">调试与验证</h3>
                            <div class="bg-blue-50 p-4 rounded-lg">
                                <div class="flex items-center mb-3">
                                    <i class="fas fa-bug text-blue-500 mr-2"></i>
                                    <h4 class="font-medium">查看激活的Profile</h4>
                                </div>
                                <p class="text-sm text-gray-700">可以通过Spring Boot的Actuator模块查看当前激活的Profile，这在调试和监控应用状态时非常有用。</p>
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-gray-100 p-6 rounded-lg">
                        <h3 class="text-xl font-bold mb-4 text-gray-800">@ActiveProfiles注解</h3>
                        <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                            <div class="code-block text-gray-200 p-4 rounded-lg">
                                <pre><code>@SpringBootTest
@ActiveProfiles("test")
public class MyServiceTest {
    @Test
    void testService() {
        // 测试代码
    }
}</code></pre>
                            </div>
                            <div>
                                <p class="text-gray-700 mb-3">在测试类上使用@ActiveProfiles注解可以指定测试运行时激活的Profile，这在测试环境中特别有用。</p>
                                <div class="bg-yellow-50 p-3 rounded-lg">
                                    <p class="text-sm text-yellow-800"><i class="fas fa-lightbulb mr-2"></i>可以结合@MockBean等注解，为不同的测试场景创建不同的测试环境</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Conditional Configuration -->
        <section id="conditional-config" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-500 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold text-gray-800">条件化配置的使用</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="p-6">
                    <p class="text-lg text-gray-700 mb-8">在Spring Boot中，条件化配置允许开发者根据特定条件来选择性地加载Bean或配置属性。这种机制不仅增强了应用的灵活性，还提高了代码的可读性和可维护性。</p>
                    
                    <h3 class="text-xl font-bold mb-6 text-gray-800">条件化注解</h3>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
                        <div class="bg-gray-50 p-5 rounded-lg">
                            <div class="flex items-center mb-3">
                                <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-3">
                                    <i class="fas fa-check"></i>
                                </div>
                                <h4 class="font-bold">@Profile</h4>
                            </div>
                            <p class="text-gray-700 mb-3">根据激活的Profile来选择性加载Bean</p>
                            <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                <code>@Profile("dev")<br>@Bean<br>public DataSource devDataSource() {...}</code>
                            </div>
                        </div>
                        
                        <div class="bg-gray-50 p-5 rounded-lg">
                            <div class="flex items-center mb-3">
                                <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-3">
                                    <i class="fas fa-sliders-h"></i>
                                </div>
                                <h4 class="font-bold">@ConditionalOnProperty</h4>
                            </div>
                            <p class="text-gray-700 mb-3">根据配置文件中的属性来决定是否加载Bean</p>
                            <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                <code>@ConditionalOnProperty(<br>&nbsp;&nbsp;name="feature.enabled", <br>&nbsp;&nbsp;havingValue="true")<br>@Bean<br>public FeatureService featureService() {...}</code>
                            </div>
                        </div>
                        
                        <div class="bg-gray-50 p-5 rounded-lg">
                            <div class="flex items-center mb-3">
                                <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-3">
                                    <i class="fas fa-file-code"></i>
                                </div>
                                <h4 class="font-bold">@ConditionalOnClass</h4>
                            </div>
                            <p class="text-gray-700 mb-3">根据类路径中是否存在特定类来决定是否加载Bean</p>
                            <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                <code>@ConditionalOnClass(name = <br>&nbsp;&nbsp;"com.demo.SomeLibrary")<br>@Bean<br>public SomeService someService() {...}</code>
                            </div>
                        </div>
                        
                        <div class="bg-gray-50 p-5 rounded-lg">
                            <div class="flex items-center mb-3">
                                <div class="w-10 h-10 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-3">
                                    <i class="fas fa-cubes"></i>
                                </div>
                                <h4 class="font-bold">@ConditionalOnBean</h4>
                            </div>
                            <p class="text-gray-700 mb-3">根据Spring容器中是否存在特定的Bean来决定是否加载当前Bean</p>
                            <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                <code>@ConditionalOnBean(name = "myBean")<br>@Bean<br>public AnotherService anotherService() {...}</code>
                            </div>
                        </div>
                    </div>
                    
                    <h3 class="text-xl font-bold mb-4 text-gray-800">自定义条件</h3>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
                        <div class="code-block text-gray-200 p-4 rounded-lg">
                            <pre><code>public class MyCondition implements Condition {
    @Override
    public boolean matches(
        ConditionContext context, 
        AnnotatedTypeMetadata metadata) {
        return System.getProperty("os.name")
            .contains("Windows");
    }
}

@Configuration
@Conditional(MyCondition.class)
public class MyConfig {
    // Windows环境下才加载的配置
}</code></pre>
                        </div>
                        <div>
                            <p class="text-gray-700 mb-4">通过实现Condition接口，可以创建自定义的条件逻辑，实现更复杂的条件化配置。</p>
                            <ul class="space-y-2 text-gray-700">
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                    <span>检查系统属性</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                    <span>验证环境变量</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                    <span>检查Bean的存在性</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                    <span>自定义业务逻辑判断</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    
                    <div class="bg-green-50 p-6 rounded-lg">
                        <h3 class="text-xl font-bold mb-4 text-green-800">最佳实践</h3>
                        <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                            <div class="bg-white p-4 rounded-lg">
                                <div class="flex items-center mb-2">
                                    <i class="fas fa-file-alt text-green-500 mr-2"></i>
                                    <h4 class="font-medium">明确条件</h4>
                                </div>
                                <p class="text-sm text-gray-600">确保条件逻辑清晰且文档化</p>
                            </div>
                            <div class="bg-white p-4 rounded-lg">
                                <div class="flex items-center mb-2">
                                    <i class="fas fa-project-diagram text-green-500 mr-2"></i>
                                    <h4 class="font-medium">减少复杂性</h4>
                                </div>
                                <p class="text-sm text-gray-600">避免过多的条件导致配置复杂</p>
                            </div>
                            <div class="bg-white p-4 rounded-lg">
                                <div class="flex items-center mb-2">
                                    <i class="fas fa-vial text-green-500 mr-2"></i>
                                    <h4 class="font-medium">充分测试</h4>
                                </div>
                                <p class="text-sm text-gray-600">为条件化配置编写测试用例</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Profile Priority -->
        <section id="profile-priority" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-500 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold text-gray-800">Profile的优先级</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="p-6">
                    <p class="text-lg text-gray-700 mb-8">在Spring Boot中，Profiles是用于为不同环境提供不同配置的一种机制。理解Profiles的优先级非常重要，因为它可以影响应用的行为和配置的选择。</p>
                    
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
                        <div>
                            <h3 class="text-xl font-bold mb-4 text-gray-800">激活顺序与优先级</h3>
                            <div class="space-y-4">
                                <div class="border-l-4 border-indigo-500 pl-4 py-1">
                                    <h4 class="font-bold text-gray-800">1. 代码中指定</h4>
                                    <p class="text-gray-600 text-sm">使用@ActiveProfiles注解，最高优先级</p>
                                </div>
                                <div class="border-l-4 border-indigo-400 pl-4 py-1">
                                    <h4 class="font-bold text-gray-800">2. 命令行参数</h4>
                                    <p class="text-gray-600 text-sm">--spring.profiles.active=prod</p>
                                </div>
                                <div class="border-l-4 border-indigo-300 pl-4 py-1">
                                    <h4 class="font-bold text-gray-800">3. 环境变量</h4>
                                    <p class="text-gray-600 text-sm">SPRING_PROFILES_ACTIVE=prod</p>
                                </div>
                                <div class="border-l-4 border-indigo-200 pl-4 py-1">
                                    <h4 class="font-bold text-gray-800">4. JVM参数</h4>
                                    <p class="text-gray-600 text-sm">-Dspring.profiles.active=prod</p>
                                </div>
                                <div class="border-l-4 border-indigo-100 pl-4 py-1">
                                    <h4 class="font-bold text-gray-800">5. 配置文件</h4>
                                    <p class="text-gray-600 text-sm">spring.profiles.active=dev，最低优先级</p>
                                </div>
                            </div>
                        </div>
                        
                        <div>
                            <h3 class="text-xl font-bold mb-4 text-gray-800">多Profile合并机制</h3>
                            <div class="bg-gray-50 p-5 rounded-lg mb-4">
                                <div class="code-block text-gray-200 p-3 rounded-lg text-sm mb-2">
                                    <code>spring.profiles.active=dev,test,prod</code>
                                </div>
                                <p class="text-gray-700">后激活的Profile中的配置会覆盖先激活Profile中的相同属性</p>
                            </div>
                            
                            <h4 class="font-bold mb-2 text-gray-800">冲突解决</h4>
                            <div class="bg-yellow-50 p-4 rounded-lg">
                                <p class="text-sm text-yellow-800 mb-2">当Bean定义冲突时，可以使用@Primary注解指定优先使用的Bean</p>
                                <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                    <code>@Profile("dev")<br>@Primary<br>@Bean<br>public DataSource dataSource() {...}</code>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-blue-50 p-6 rounded-lg">
                        <h3 class="text-xl font-bold mb-4 text-blue-800">Profile优先级可视化</h3>
                        <div class="mermaid">
                            graph LR
                            A[最高优先级] --> B[@ActiveProfiles]
                            B --> C[命令行参数]
                            C --> D[环境变量]
                            D --> E[JVM参数]
                            E --> F[配置文件]
                            F --> G[最低优先级]
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Practice Example -->
        <section id="practice-example" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="w-2 h-12 bg-indigo-500 rounded-full mr-4"></div>
                <h2 class="text-3xl font-bold text-gray-800">实践示例</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="p-6">
                    <p class="text-lg text-gray-700 mb-8">在Spring Boot应用中，使用Profiles来管理不同环境的配置是一种常见的做法。以下是一个关于如何使用Profiles和配置优先级的具体实践示例。</p>
                    
                    <h3 class="text-xl font-bold mb-4 text-gray-800">项目结构</h3>
                    <div class="bg-gray-50 p-5 rounded-lg mb-8">
                        <div class="code-block text-gray-200 p-4 rounded-lg">
                            <pre><code>my-spring-boot-app/
├── src/
│   └── main/
│       ├── java/
│       └── resources/
│           ├── application.yml
│           ├── application-dev.yml
│           ├── application-test.yml
│           └── application-prod.yml</code></pre>
                        </div>
                    </div>
                    
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
                        <div>
                            <h3 class="text-xl font-bold mb-4 text-gray-800">配置文件示例</h3>
                            <div class="space-y-6">
                                <div>
                                    <h4 class="font-bold mb-2 text-gray-700">application.yml (默认)</h4>
                                    <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                        <pre><code>spring:
  application:
    name: my-spring-boot-app
  datasource:
    url: jdbc:mysql://localhost:3306/default_db
    username: default_user
    password: default_password</code></pre>
                                    </div>
                                </div>
                                
                                <div>
                                    <h4 class="font-bold mb-2 text-gray-700">application-dev.yml</h4>
                                    <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                        <pre><code>spring:
  profiles: dev
  datasource:
    url: jdbc:mysql://localhost:3306/dev_db
    username: dev_user
    password: dev_password</code></pre>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <div>
                            <h3 class="text-xl font-bold mb-4 text-gray-800">条件化配置示例</h3>
                            <div class="code-block text-gray-200 p-4 rounded-lg mb-4">
                                <pre><code>@Profile("dev")
@Component
public class DevService implements MyService {
    @Override
    public void execute() {
        System.out.println("Executing in dev mode");
    }
}

@Profile("prod")
@Component
public class ProdService implements MyService {
    @Override
    public void execute() {
        System.out.println("Executing in prod mode");
    }
}</code></pre>
                            </div>
                            <p class="text-gray-700">根据激活的Profile，Spring会加载对应的服务实现。</p>
                        </div>
                    </div>
                    
                    <div class="bg-gray-100 p-6 rounded-lg">
                        <h3 class="text-xl font-bold mb-4 text-gray-800">激活Profile的不同方式</h3>
                        <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
                            <div class="bg-white p-4 rounded-lg">
                                <h4 class="font-bold mb-2 text-gray-800">命令行</h4>
                                <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                    <code>java -jar myapp.jar --spring.profiles.active=dev</code>
                                </div>
                            </div>
                            <div class="bg-white p-4 rounded-lg">
                                <h4 class="font-bold mb-2 text-gray-800">环境变量</h4>
                                <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                    <code>export SPRING_PROFILES_ACTIVE=prod</code>
                                </div>
                            </div>
                            <div class="bg-white p-4 rounded-lg">
                                <h4 class="font-bold mb-2 text-gray-800">JVM参数</h4>
                                <div class="code-block text-gray-200 p-3 rounded-lg text-sm">
                                    <code>java -Dspring.profiles.active=test -jar myapp.jar</code>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Summary -->
        <section class="mb-16">
            <div class="bg-gradient-to-r from-indigo-500 to-purple-600 rounded-xl shadow-md overflow-hidden">
                <div class="p-8 text-white">
                    <h2 class="text-2xl md:text-3xl font-bold mb-6">Spring Profiles核心要点总结</h2>
                    <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                        <div>
                            <ul class="space-y-3">
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-200 mr-2 mt-0.5">
                                        <i class="fas fa-check-circle"></i>
                                    </div>
                                    <span>Profiles是实现环境隔离的强大工具</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-200 mr-2 mt-0.5">
                                        <i class="fas fa-check-circle"></i>
                                    </div>
                                    <span>支持多种激活方式，优先级不同</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-200 mr-2 mt-0.5">
                                        <i class="fas fa-check-circle"></i>
                                    </div>
                                    <span>配置文件组织清晰，命名规范</span>
                                </li>
                            </ul>
                        </div>
                        <div>
                            <ul class="space-y-3">
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-200 mr-2 mt-0.5">
                                        <i class="fas fa-check-circle"></i>
                                    </div>
                                    <span>条件化配置增加灵活性</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-200 mr-2 mt-0.5">
                                        <i class="fas fa-check-circle"></i>
                                    </div>
                                    <span>多Profile激活时后加载的配置会覆盖先前的</span>
                                </li>
                                <li class="flex items-start">
                                    <div class="flex-shrink-0 h-6 w-6 text-indigo-200 mr-2 mt-0.5">
                                        <i class="fas fa-check-circle"></i>
                                    </div>
                                    <span>结合最佳实践提升可维护性</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-8 px-4">
        <div class="container mx-auto max-w-5xl text-center">
            <div class="mb-4">
                <h3 class="text-xl font-bold">技术小馆</h3>
                <p class="text-gray-400 mt-2">探索技术的无限可能</p>
            </div>
            <div class="flex justify-center space-x-6">
                <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition duration-300">
                    <i class="fas fa-book-open mr-1"></i> 语雀地址
                </a>
            </div>
            <div class="mt-6 text-sm text-gray-500">
                &copy; 2023 技术小馆. All rights reserved.
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
        
        // 卡片悬停效果
        const cards = document.querySelectorAll('.card');
        cards.forEach(card => {
            card.addEventListener('mouseenter', () => {
                card.style.transform = 'translateY(-5px)';
                card.style.boxShadow = '0 10px 15px rgba(0, 0, 0, 0.1)';
            });
            card.addEventListener('mouseleave', () => {
                card.style.transform = '';
                card.style.boxShadow = '0 4px 6px rgba(0, 0, 0, 0.05)';
            });
        });
    </script>
</body>
</html>
```